package com.frame.sqlsession.support;

import com.frame.config.Configuration;
import com.frame.sqlsession.SqlSession;
import com.frame.sqlsession.SqlSessionFactory;

/**
 * @Description SqlSessionFactory 接口的实现类
 * @Author Mokairui
 * @Since 2021/11/28
 */
public class DefaultSqlSessionFactory implements SqlSessionFactory {

    private Configuration config;

    public DefaultSqlSessionFactory(Configuration config) {
        this.config = config;
    }

    /**
     * 用于创建一个新的操作数据库对象
     * @return
     */
    @Override
    public SqlSession openSession() {
        return new DefaultSqlSession(config);
    }
}
